Current Location: Home> Function Categories> abs

abs

Absolute value
Name:abs
Category:math
Programming Language:php
One-line Description:Absolute value.

Definition and usage

abs() function returns the absolute value of a number.

Example

 <?php
echo ( abs ( 6.7 ) ) ;
echo ( abs ( - 3 ) ) ;
echo ( abs ( 3 ) ) ;
?>

Try it yourself

grammar

 abs ( x )
parameter describe
x Required. A number.

illustrate

Returns the absolute value of parameter x . If the parameter x is float, the returned type is also float, otherwise the integer is returned (because float usually has a larger range of values ​​than integer).